Skip to content

Apply login-shell -l flag when args array is empty#40

Merged
nedtwigg merged 1 commit intomainfrom
fix/standalone-login-shell-args
May 1, 2026
Merged

Apply login-shell -l flag when args array is empty#40
nedtwigg merged 1 commit intomainfrom
fix/standalone-login-shell-args

Conversation

@nedtwigg
Copy link
Copy Markdown
Member

@nedtwigg nedtwigg commented May 1, 2026

Summary

  • resolveSpawnConfig used explicitArgs || resolveLoginArg(...). Empty arrays are truthy in JS, so an args: [] from detectAvailableShells (the default on Unix) suppressed the -l fallback and the shell launched without login mode.
  • On standalone macOS this skipped ~/.zprofile, so eval "$(brew shellenv)" never ran and /opt/homebrew/bin was missing from PATH. ~/.zshrc still loaded asdf's java plugin, and its precmd hook printed asdf_update_java_home:2: command not found: asdf on every prompt.
  • VS Code hid the bug because the extension host inherits a fully resolved login-shell env at startup, so the spawned shell got Homebrew on PATH even without -l.
  • Fix: treat an empty args array as "no override" and fall through to resolveLoginArg. Updated the test that pinned the buggy behavior; added a regression test for the macOS/zsh case and one that confirms non-empty explicit args (e.g. WSL -d <distro>) still pass through unchanged.

Test plan

  • node --test standalone/sidecar/pty-core.test.js — 18/18 pass
  • Build the standalone macOS app from this branch, launch from Finder, confirm fresh prompts no longer print asdf_update_java_home:2: command not found: asdf
  • Confirm echo $PATH inside a standalone terminal includes /opt/homebrew/bin and the asdf shims directory
  • Smoke test the VS Code extension to make sure shell spawn behavior is unchanged

🤖 Generated with Claude Code

Empty arrays are truthy in JS, so `explicitArgs || resolveLoginArg(...)`
preserved the empty array and skipped the -l fallback. detectAvailableShells
returns args:[] on Unix, which propagates through the default-shell flow,
so on standalone macOS the spawned zsh ran without -l. ~/.zprofile was
skipped, /opt/homebrew/bin never landed on PATH, and asdf's precmd hook
emitted "command not found: asdf" on every prompt. VS Code hid the bug by
hydrating its own env from a login shell at startup.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3259b8b
Status: ✅  Deploy successful!
Preview URL: https://e241c349.mouseterm.pages.dev
Branch Preview URL: https://fix-standalone-login-shell-a.mouseterm.pages.dev

View logs

@nedtwigg nedtwigg merged commit 25475bf into main May 1, 2026
3 checks passed
@nedtwigg nedtwigg deleted the fix/standalone-login-shell-args branch May 1, 2026 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant